﻿// Type: System.Data.Objects.ObjectSet`1
// Assembly: System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Data.Entity.dll

using System.Collections;
using System.Collections.Generic;
using System.Data.Metadata.Edm;
using System.Linq;
using System.Runtime;

namespace System.Data.Objects
{
    /// <summary>
    /// Represents a typed entity set that is used to perform create, read, update, and delete operations.
    /// </summary>
    /// <typeparam name="TEntity">The entity type.</typeparam>
    public class ObjectSet<TEntity> : ObjectQuery<TEntity>, IObjectSet<TEntity>, IQueryable<TEntity>, IEnumerable<TEntity>, IQueryable, IEnumerable where TEntity : class
    {
        /// <summary>
        /// Adds an object to the object context in the current entity set.
        /// </summary>
        /// <param name="entity">The object to add.</param>
        public void AddObject(TEntity entity);

        /// <summary>
        /// Attaches an object or object graph to the object context in the current entity set.
        /// </summary>
        /// <param name="entity">The object to attach.</param>
        public void Attach(TEntity entity);

        /// <summary>
        /// Marks an object for deletion.
        /// </summary>
        /// <param name="entity">An object that represents the entity to delete. The object can be in any state except <see cref="F:System.Data.EntityState.Detached"/>. </param>
        public void DeleteObject(TEntity entity);

        /// <summary>
        /// Removes the object from the object context.
        /// </summary>
        /// <param name="entity">Object to be detached. Only the <paramref name="entity"/> is removed; if there are any related objects that are being tracked by the same <see cref="T:System.Data.Objects.ObjectStateManager"/>, those will not be detached automatically.</param>
        public void Detach(TEntity entity);

        /// <summary>
        /// Sets the <see cref="P:System.Data.Objects.ObjectStateEntry.CurrentValues"/> property of an <see cref="T:System.Data.Objects.ObjectStateEntry"/> to match the property values of a supplied object.
        /// </summary>
        /// 
        /// <returns>
        /// The updated object.
        /// </returns>
        /// <param name="currentEntity">The detached object that has property updates to apply to the original object.</param>
        public TEntity ApplyCurrentValues(TEntity currentEntity);

        /// <summary>
        /// Sets the <see cref="P:System.Data.Objects.ObjectStateEntry.OriginalValues"/> property of an <see cref="T:System.Data.Objects.ObjectStateEntry"/> to match the property values of a supplied object.
        /// </summary>
        /// 
        /// <returns>
        /// The updated object.
        /// </returns>
        /// <param name="originalEntity">The detached object that has property updates to apply to the original object.</param>
        public TEntity ApplyOriginalValues(TEntity originalEntity);

        /// <summary>
        /// Creates a new entity type object.
        /// </summary>
        /// 
        /// <returns>
        /// The new entity type object, or an instance of a proxy type that corresponds to the entity type.
        /// </returns>
        public TEntity CreateObject();

        /// <summary>
        /// Creates an instance of the specified type.
        /// </summary>
        /// 
        /// <returns>
        /// An instance of the requested type <paramref name="T"/>, or an instance of a proxy type that corresponds to the type <paramref name="T"/>.
        /// </returns>
        /// <typeparam name="T">Type of object to be returned.</typeparam>
        public T CreateObject<T>() where T : class, TEntity;

        /// <summary>
        /// Gets the metadata of the entity set represented by this <see cref="T:System.Data.Objects.ObjectSet`1"/> instance.
        /// </summary>
        /// 
        /// <returns>
        /// An <see cref="T:System.Data.Metadata.Edm.EntitySet"/> object.
        /// </returns>
        public EntitySet EntitySet { [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
        get; }
    }
}
